<script>
import { Tooltip } from 'element-ui'

export default {
  name: 'zlToolTip',
  extends: Tooltip,
  props: {
    ...Tooltip.props,
    overflow: Boolean
  },
  methods: {
    show() {
      if (this.overflow) {
        if (this.$el.scrollWidth <= this.$el.clientWidth) return
      }
      Tooltip.methods.show.call(this)
    }
  },
  updated() {
    if (!this.content && !this.$slots.content) {
      this.$set(this, 'content', this.$el.innerText)
    }
  }
}
</script>
